package com.qf.config;


import com.qf.properties.RedisProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
 * 连接redis的配置信息
 */
@Configuration
public class RedisConfig {

    @Autowired
    private RedisProperties redis;


    @Bean
    public JedisPool pool(){

        JedisPoolConfig poolConfig = new JedisPoolConfig();

        JedisPool jedisPool = new JedisPool(poolConfig,redis.getHost(), redis.getPort(),redis.getTimeout(),redis.getPassword(),redis.getDatabase());

        return jedisPool;
    }

}
